/*
 * @Date: 2023-01-08 13:47:28
 * @LastEditors: Zireael 1193875164@qq.com
 * @LastEditTime: 2023-03-25 11:37:36
 * @FilePath: \A19\frontend\src\pinia\stores\client.ts
 */
import { HttpClient } from 'tsrpc-browser';
import { ServiceType } from '@/shared/protocols/serviceProto';
import { WsClient } from 'tsrpc-browser';
import { defineStore } from "pinia"
import { getClient } from '@/getClient';
import { initClient } from '@/hooks/initClient';

export const useClientStore = defineStore('client', {
    state: () => {
        return {
            client: (() => {
                const client = getClient()
                initClient(client)
                return client
            })(),
            currentUser: {} as {
                _id:string,
                role: string
                school: string,
                name: string,
                portrait: string,
                email: string,
                number: string,
                gender: number
            },
            currentCourseId:'',
        }
    },
    getters:{}
})